import 'package:finance_app/generated/json/base/json_convert_content.dart';
import 'package:finance_app/generated/json/base/json_field.dart';
import 'package:finance_app/src/entities/business_contact_entity.dart';
import 'package:finance_app/src/entities/invoice_detail_entity.dart';

class InvoiceEntity with JsonConvert<InvoiceEntity> {
  @JSONField(name: "data_type")
  String dataType;
  int id;
  @JSONField(name: "company_id")
  int companyId;
  @JSONField(name: "contact_id")
  int contactId;
  @JSONField(name: "quotation_id")
  int quotationId;
  String number;
  @JSONField(name: "quotation_number")
  String quotationNumber;
  @JSONField(name: "issued_at")
  String issuedAt;
  @JSONField(name: "delivery_at")
  String deliveryAt;
  @JSONField(name: "due_at")
  String dueAt;
  @JSONField(name: "currency_code")
  String currencyCode;
  num subtotal;
  @JSONField(name: "exclusive_tax_amount")
  num exclusiveTaxAmount;
  @JSONField(name: "inclusive_tax_amount")
  num inclusiveTaxAmount;
  @JSONField(name: "discount_type")
  String discountType;
  @JSONField(name: "discount_amount")
  num discountAmount;
  num total;
  dynamic notes;
  String status;
  @JSONField(name: "created_by")
  dynamic createdBy;
  @JSONField(name: "created_at")
  String createdAt;
  @JSONField(name: "updated_at")
  String updatedAt;
  List<InvoiceDetailItems> items;
  BusinessContactEntity contact;

  num unpaid;
  @JSONField(name: "is_overdue")
  int isOverdue;
}

class InvoiceItems with JsonConvert<InvoiceItems> {
  @JSONField(name: "data_type")
  String dataType;
  int id;
  @JSONField(name: "company_id")
  int companyId;
  @JSONField(name: "invoice_id")
  int invoiceId;
  String type;
  @JSONField(name: "type_id")
  int typeId;
  String name;
  int quantity;
  @JSONField(name: "currency_code")
  String currencyCode;
  @JSONField(name: "tax_id")
  int taxId;
  num price;
  @JSONField(name: "nett_price")
  num nettPrice;
  @JSONField(name: "is_tax_inclusive")
  int isTaxInclusive;
  @JSONField(name: "tax_amount")
  num taxAmount;
  @JSONField(name: "created_at")
  String createdAt;
  @JSONField(name: "updated_at")
  String updatedAt;
}
